package com.easyaccount.controller;

import com.easyaccount.commons.CommonResp;
import com.easyaccount.exception.BizException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionResolver {

    @ExceptionHandler(BizException.class)
    @ResponseBody
    public CommonResp bizException(BizException e){
        return CommonResp.failed(e.getMessage(),e.getCode());
    }

}
